//
//  MOFoodZhanDanViewCell.m
//  MobileOffice
//
//  Created by 冰冰 on 2019/10/22.
//  Copyright © 2019 com.idolmedia. All rights reserved.
//

#import "MOFoodZhanDanViewCell.h"

@interface MOFoodZhanDanViewCell ()

@property (nonatomic, strong) UIView *backView;

@property (nonatomic, strong) UILabel *titleLabel;

@property (nonatomic, strong) UILabel *timeLabel;

@property (nonatomic, strong) UILabel *numberLabel;

@end

@implementation MOFoodZhanDanViewCell

- (MOFoodZhanDanViewCell *)cellCreat:(NSString *)cellIdentifier AndArray:(NSMutableArray *)array andTableView:(UITableView *)tableView cellIndexPath:(NSIndexPath *)indexPath andType:(NSInteger)type{
    YPBaseSwipeTableViewCell *cell  = [self initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier withBtn:array tableView:tableView cellIndexPath:indexPath andType:type];
    self.YPContentView.backgroundColor = KGrayColor_f8f8f8;
    [cell creatUI];
    return self;
}


-(void)creatUI
{
    [self.YPContentView addSubview:self.backView];
}

-(void)setModel:(MOFoodZhanDanModel *)model
{
    NSString *type = @"";
    if ([model.typeStr integerValue]==0) {
        type = @"充值";
    }else if ([model.typeStr integerValue]==1) {
        type = @"消费";
    }else if ([model.typeStr integerValue]==2) {
        type = @"退款";
    }
    self.titleLabel.text = type;
    self.numberLabel.text = [NSString stringWithFormat:@"账单时间：%@",model.dateStr];
    self.timeLabel.text = model.priceStr;
}

#pragma mark -懒加载

- (UIView *)backView{
    if (!_backView) {
        _backView = [[UIView alloc] initWithFrame:CGRectMake(10, 0, SCREEN_WIDTH - 10*2, 80)];
        _backView.backgroundColor = KWhiteColor;
        
        [_backView addSubview:self.titleLabel];
        [_backView addSubview:self.timeLabel];
        [_backView addSubview:self.numberLabel];
        
    }
    return _backView;
}

- (UILabel *)titleLabel{
    if (!_titleLabel) {
        _titleLabel = [[UILabel alloc]initWithFrame:CGRectMake(18, 16, (self.backView.width - 20)/2, 16)];
        _titleLabel.font = [UIFont boldSystemFontOfSize:16];
        _titleLabel.textColor = KBlackColor_2A2A2A;
        _titleLabel.text = @"第一餐厅";
    }
    return _titleLabel;
}

- (UILabel *)timeLabel{
    if (!_timeLabel) {
        _timeLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.titleLabel.right, self.titleLabel.top, self.titleLabel.width - 18, self.titleLabel.height)];
        _timeLabel.font = FONT_SIZE(13);
        _timeLabel.textAlignment = NSTextAlignmentRight;
        _timeLabel.textColor = KBlackColor_2A2A2A;
        _timeLabel.text = @"2019-10-09:09:00:00";
    }
    return _timeLabel;
}

- (UILabel *)numberLabel{
    if (!_numberLabel) {
        _numberLabel = [[UILabel alloc] initWithFrame:CGRectMake(self.titleLabel.left, self.titleLabel.bottom + 19, self.backView.width, 13)];
        _numberLabel.font = FONT_SIZE(13);
        _numberLabel.textColor = KBlackColor_2A2A2A;
        _numberLabel.text = @"餐品数量：6例";
    }
    return _numberLabel;
}


@end
